Skip to content

Auto-install Playwright Chromium when opening the annotation browser#3841

Merged
youknowriad merged 2 commits into
trunkfrom
fix-annotation-browser-auto-install
Jun 17, 2026
Merged

Auto-install Playwright Chromium when opening the annotation browser#3841
youknowriad merged 2 commits into
trunkfrom
fix-annotation-browser-auto-install

Conversation

@youknowriad

@youknowriad youknowriad commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • Related to #

How AI was used in this PR

Claude Code investigated the /annotate failure, traced it to the annotation browser bypassing Studio's shared browser launcher, implemented the fix, and wrote it up. All code was reviewed by the author.

Proposed Changes

When a user runs /annotate, Studio opens a headed Playwright browser with the annotation inspector injected. If Playwright's managed Chromium was missing or had just been version-bumped (a common situation after a Playwright upgrade), this failed with a raw Executable doesn't exist ... Please run 'npx playwright install' error, leaving the user stuck unless they manually installed the browser.

Studio's screenshot and block-validation tools already handle this gracefully: they fall back across launch targets and auto-install Playwright's Chromium on demand. The annotation browser simply wasn't using that path — it launched Chromium directly.

This change routes the annotation browser through the same shared launcher, so a missing or outdated Chromium is now installed automatically (using the bundled Playwright version, avoiding any version drift) instead of surfacing a dead-end error. Users get a working annotation browser on first run without manual setup.

Testing Instructions

  1. Remove Playwright's managed browser to simulate a fresh/post-upgrade machine: rm -rf ~/Library/Caches/ms-playwright (macOS).
  2. Build the CLI: npm run cli:build.
  3. Trigger the annotation browser via /annotate (or the open_annotation_browser tool) against a running Studio site.
  4. Expected: Chromium is auto-installed and the annotation browser opens, with no manual npx playwright install step required.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 38c3d01 vs trunk

app-size

Metric trunk 38c3d01 Diff Change
App Size (Mac) 2334.13 MB 2334.13 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 38c3d01 Diff Change
load 1696 ms 1757 ms +61 ms 🔴 3.6%

site-startup

Metric trunk 38c3d01 Diff Change
siteCreation 8507 ms 8542 ms +35 ms ⚪ 0.0%
siteStartup 3870 ms 3874 ms +4 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad youknowriad merged commit 4bd3513 into trunk Jun 17, 2026
11 of 13 checks passed
@youknowriad youknowriad deleted the fix-annotation-browser-auto-install branch June 17, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants